home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WW3DKit / Protocol_WWRenderable.h < prev    next >
Encoding:
Text File  |  1995-03-22  |  6.5 KB  |  123 lines

  1. // copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
  2. // see COPYRIGHT for reuse legalities
  3. //
  4.  
  5. #import <appkit/appkit.h>
  6. #import <3Dkit/3Dkit.h>
  7. #import "WW3DCamera.h"
  8. #import "WW3DAttributeState.h"
  9.  
  10. @protocol WWRenderable
  11.  
  12. // this method should be implemented as - class {  return [super class]; }
  13. // I have to declare it because otherwise the compiler whines at me...
  14. - class;
  15.  
  16. // this is a bit of a cheat, here, but the doc is a bit stupid.  If you have
  17. // objects *that are a component part of you* (like, say, you're a compound
  18. // command and you've got a bunch of renderable commands inside of you), you
  19. // need to make unique copies of those objects.  In other words, if you would
  20. // free it when you got free'ed, then you should make a unique copy of it.
  21. - copyFromZone:(NXZone *)zone;
  22.  
  23. // If the object pushes or pops the current transformation matrix, this
  24. // method returns YES.  If the object does this in a balanced way internally,
  25. // i.e. it pushes the ctm twice and then pops it twice, it should return NO.
  26. // The degenerate case of that is if the object doesn't pop or push it all.
  27. // Examples of current WW3DKit objects that do return YES would be RIBAttributeBegin,
  28. // RIBAttributeEnd, RIBSolidBegin, RIBSolidEnd, RIBTransformBegin, RIBTransformEnd
  29. - (BOOL)pushesOrPopsCTM;
  30. // these two methods should also be implemented
  31. - (BOOL)pushesCTM;  // RIBAttributeBegin, RIBTransformBegin, RIBSolidBegin
  32. - (BOOL)popsCTM; // RIBAttributeEnd, RIBTransformEnd, RIBSolidEnd
  33.  
  34.  
  35. // If the object occupies some volume of space, this should return YES.
  36. // If it returns NO, the following three methods probably won't be called,
  37. // but they should be implemented reasonably just to be safe.
  38. - (BOOL)hasBoundingBox;
  39.  
  40. // this is the accessor that should be used by other objects that wish
  41. // to inquire about this object's bounding box.  It needs to guarantee
  42. // that value it is returning is currently valid.
  43. // note that is a change over the old time independent method, which was 
  44. // too dangerous to keep around
  45. - (RtBound *)boundingBoxStartingAt:(RtFloat)intervalStartTime endingAt:(RtFloat)intervalEndTime;
  46.  
  47. // this calculates the maximum extent this object occupies over the duration specified
  48. // this should also be private, or maybe even go away from public scrutinty...
  49. - calculateBoundingBoxStartingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
  50.  
  51. // this is a private method, should only used by an instance on itself
  52. - setBoundingBox:(RtBound *)newBoundingBox;
  53.  
  54. - renderMaps:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime usingStream:(NXStream *)ns; 
  55. - renderMaps:(WW3DCamera *)camera usingStream:(NXStream *)ns;
  56. - renderMaps:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
  57. - renderMaps:(WW3DCamera *)camera;
  58. - renderSelfAsBox:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
  59. - renderSelf:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
  60. - renderSelf:(WW3DCamera *)camera;
  61. - preRenderSelf:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
  62. - preRenderSelf:(WW3DCamera *)camera;
  63.  
  64. // note this is changed from the 2.0 method; sending RtMatrix over the wire is just a bad idea (and it also couldn't contain enough info)
  65. - transformCTM:(WW3DAttributeState *)attributeState startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
  66.  
  67. - (BOOL)isMotionBlurrable;
  68. - (BOOL)isCompoundCommand;
  69. // if you're not an animatable command, return 0.0 (although it won't be used...)
  70. - (float)lastSampleIsAt;
  71.  
  72. // by implementing this method, you're guaranteeing that you can return a
  73. // linear interpolated version of yourself and "b".  You should check to
  74. // make sure that "b" responds to the appropriate methods.  Also, "uValue"
  75. // is supposed to be between 0 and 1, although if you want to deal with
  76. // values out of that range, knock yourself out...
  77. // also note that even if b is totally bogus, you should at least return self
  78. - (BOOL)isLerpable;
  79. - lerpWith:b by:(float)uValue; // this method may return self, b, or a new copy
  80. - lerpSelfWith:b by:(float)uValue; // this method may return self or b
  81.  
  82. // this method returns the number of bytes of bandwidth that this
  83. // command would consume over the wire.  If unsure, err on the larger
  84. // side.  This methods is merely for communication bandwidth
  85. // visualization, so don't be overly concerned about it...
  86. - (unsigned long int)maxSampleBandwidth;
  87.  
  88. - writeEve:(NXStream *)stream atTabLevel:(int)tab;
  89. // unless you're an animatable command, writeScene:atTabLevel is exactly the same as writeEve:atTabLevel:
  90. - writeScene:(NXStream *)stream atTabLevel:(int)tab;
  91. - write3DTextScene:(NXStream *)stream atTabLevel:(int)tab index:(int)index time:(float)time until:(float)lastTime;
  92. - writeInventorAtTime:(float)currentTime to:(NXStream *)stream atTabLevel:(int)tab;
  93.  
  94. // this method will be sent to allow an instance to compare itself
  95. // against another instance.  This is really a housekeeping command to
  96. // help generate the most concise RIB file possible.  This method is
  97. // usually called when building up a (set of) MotionBegin/End block(s),
  98. // so if a command responds NO to this, then a MotionBegin/End block will
  99. // be written, otherwise just the first command will be.  If you're
  100. // unsure, return NO.  You'll have a fatter RIB file, but hey...
  101. - (BOOL)theSameAs:otherRIBCommand;
  102.  
  103. // similarTo: is much weaker than "theSameAs:", and is used mainly to
  104. // differentiate the various polygon and patch commands from each other
  105. // in MotionBegin/End blocks
  106. - (BOOL)similarTo:otherRIBCommand;
  107.  
  108. // if this particular instance is moot, like a RIBSphere with a radius of 0, or a cylinder with zMin == zMax, etc., then
  109. // this should return YES, otherwise no.  This is really a housekeeping command to help generate the most concise RIB file
  110. // possible.  If you're unsure, return NO
  111. - (BOOL)isMoot;
  112. - (BOOL)isMootStartingAt:(float)startTime endingAt:(float)endTime;
  113.  
  114. // please note that while objects that conform to this protocol have
  115. // to implement the various startingAt:endingAt: routines, they're not
  116. // expected to do anything different than their shorter named
  117. // corresponding routines.  It's only objects that conform to the
  118. // WWAnimatable protocol are really expected to do anything weird (i.e. motion blur) there.
  119. // The same goes for the lastSampleAt method; unless a command is animatable,
  120. // it has no notion of extent or position with respect to time; only animatable commands do.
  121.  
  122. @end
  123.